import http from '@/utils/http/axios';

// 通用组织树结构
export function getDeptTreeApi(params = {}) {
  return http.request({
    url: '/system/sysOrg/getTree',
    params,
  });
}

// 获取组织树列表
export function getTreeByEntityApi(params = {}) {
  return http.request({
    url: '/system/sysOrg/getTreeByEntity',
    method: 'get',
    params,
  });
}

// 添加部门
export function addDeptApi(params = {}) {
  return http.request({
    url: '/system/sysOrg',
    method: 'post',
    params,
  });
}

// 修改部门
export function modifyDeptApi(params = {}) {
  return http.request({
    url: '/system/sysOrg',
    method: 'put',
    params,
  });
}

// 删除部门
export function deleteDeptApi(params) {
  return http.request({
    url: `/system/sysOrg/${params.id}`,
    method: 'delete',
    params,
  });
}
